package com.alex.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * 存储到内存里的工具类,具体是存储redis还是session要看需求.
 */
@Component
@Slf4j
public class CacheUtil {

    @Resource
    HttpSession session;


    public Object getObjectByRedis(String key) {
        Object obj = null;
        try {
            obj = RedisUtil.getObject(key);
        } catch (Exception e) {

        }

        return obj;
    }


    public void saveObjectByRedis(String key, Object value) {
        RedisUtil.saveObject(key, value);
    }


}